package com.designpattern.softwaredesignpatternstudy.pdai.singleton;

/**
 * @author: Aster
 * @note:  饿汉式
 * @create: 2025-07-16 15:17
 **/
public class Singleton01 {

    private final static Singleton01 instance = new Singleton01();

    private Singleton01() {
        if (instance != null) {
            throw new RuntimeException("单例构造器禁止反射调用");
        }
    }

    public static Singleton01 getInstance() {
        return instance;
    }
}
